<?php
    header('Content-type:text/json');
    require "../connection.php";
    $carts = $_POST['carts'];
    $cartsstr = json_decode($carts,$assoc= true);
    $return = 0;
    echo json_encode($cartsstr);
    for($i=0,$len=count($cartsstr);$i<$len;$i++){
        if($cartsstr[$i]['ischecked']){
             $goods_id = $cartsstr[$i]['goods_id'];
             $user_id = $cartsstr[$i]['user_id'];
             $sql = "update cart set status = 0 where goods_id = '$goods_id' and user_id = '$user_id'";
            $result = $conn->doSql($sql);
            if($result){
               $return = $result;
            }
        }

    }
      echo json_encode($return);
?>